<?php

/*
Edit Pages (admin_edit_pages.php)
*/

$page_title = "Edit Pages";
$rank_check = 7;
include "../header.inc.php";

print "$openHTML";

if (!$page)
{
	$findPages = mysql_query("SELECT * FROM game_pages2 WHERE game = '$game'");
	while ($getPages = mysql_fetch_array($findPages))
	{
		$listPages .= "<option value=$getPages[id]>$getPages[page_title]";
	}
ECHO <<<END
<P><FORM ACTION="admin_edit_pages.php?game=$game&page=edit" METHOD=POST>
Edit which page?<br>
<select name=edit>
<option>-- Choose a page to edit!
$listPages
</select><Br>
<INPUT TYPE=submit NAME=Submit VALUE="Edit Page">
</FORM>
END;

}

if ($page == "edit")
{
$findPage = fetch("SELECT * FROM game_pages2 WHERE game = '$game' AND id = '$edit'");
if ($findPage[login_required] == 1) { $checked = " CHECKED"; }

ECHO <<<END

<P><FORM ACTION="admin_edit_pages.pro.php?game=$game&edit=$edit" METHOD=POST>
   <P>Page Title:<INPUT TYPE=text NAME="page_title" VALUE="$findPage[page_title]" SIZE=30 MAXLENGTH=64></P>
   
   <P>Page Content:</P>
   
   <P><TEXTAREA NAME=page_content ROWS=17 COLS=66 WRAP=virtual>$findPage[content]</TEXTAREA></P>

	<p>Login required? <input type=checkbox name=login_required value=1$checked> (checked = yes)</p>
   
   <P><INPUT TYPE=submit NAME=Submit VALUE="Edit Page">
</FORM></P>

END;
}

print "$closeHTML";
?>
